/**
 * 
 */
package com.gmail.avereshchaga.db.service;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.gmail.avereshchaga.db.dao.IDivisionDAO;
import com.gmail.avereshchaga.db.entity.IDivision;

/**
 * @author <a href="mailto:avereshchaga@gmail.com">Vereshchaga Alexey</a>
 * 
 */
@Service
public class DivisionServiceImpl implements IDivisionService {

    @Autowired
    private IDivisionDAO divisionDAO;

    @Transactional
    public void createDivision(IDivision division) {
        divisionDAO.createDivision(division);
    }

    @Transactional
    public IDivision readDivision(Long id) {
        return divisionDAO.readDivision(id);
    }

    @Transactional
    public void updateDivivsion(IDivision division) {
        divisionDAO.updateDivivsion(division);
    }

    @Transactional
    public List<IDivision> findAll() {
        return new ArrayList<IDivision>(divisionDAO.findAll());
    }

    /**
     * @return the divisionDAO
     */
    public IDivisionDAO getDivisionDAO() {
        return divisionDAO;
    }

    /**
     * @param divisionDAO the divisionDAO to set
     */
    public void setDivisionDAO(IDivisionDAO divisionDAO) {
        this.divisionDAO = divisionDAO;
    }

}
